package com.youlai.boot.util.lwb;

import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.pinyin.PinyinUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;

import java.util.Arrays;
import java.util.List;

public class TestExcel4 {
    public static void main(String[] args) {
//        try {
            String filePath = "E://项目数据导入模版.xls";
            ExcelReader excelReader = ExcelUtil.getReader(filePath);
            ExcelReader setSheet2 = excelReader.setSheet(1);
            List<List<Object>> sheet2Data = setSheet2.read(2);
            for (List<Object> sheet2Datum : sheet2Data) {

                Object index = sheet2Datum.get(0);
                Object name = sheet2Datum.get(1);

                String pinyin = PinyinUtil.getFirstLetter(name.toString(), "");
                pinyin = pinyin.toLowerCase();
                String filed = pinyin + index;
                String filed1 = pinyin + index + "jb";

                String template ="@Mapping(source = \"%s\", target = \"%s\"),";
                System.out.println(String.format(template,  filed1, filed));

            }


//            System.out.println(sheet2Data);
//
//        } catch (Exception e) {
//            System.err.println("处理Excel文件出错: " + e.getMessage());
//        }
    }
}
